home *** CD-ROM | disk | FTP | other *** search
/ Libris Britannia 4 / science library(b).zip / science library(b) / PACKET / MBBIOS34.ZIP / README < prev   
Text File  |  1988-08-16  |  15KB  |  363 lines

  1. MBBIOS is an assembler language program that captures INT 14 (the COM
  2. service call) and extends it with support for the 8250 async port in
  3. buffered mode and adds support for the 8530 PACCOMM PC-100 packet board.
  4. It is configured by the file MBCNF.ASM.  MBBIOS is a resident extension
  5. to DOS and only has to be invoked once.
  6.  
  7.    Copyright 1986, 1987, 1988 by H. Roy Engehausen.  All rights reserved.
  8.    This software may be freely distributed and used, but it may not
  9.    under any circumstances be sold by anyone other than the author.
  10.    It may be distributed by a commercial company as long as it is
  11.    for no cost.
  12.  
  13.    Permission is explicity granted to use this code as a model for
  14.    other programs requiring interrupt driven serial I/O as long as they
  15.    carry this copyright notice and the imbedded constants
  16.  
  17. ================================================================================
  18. !                                                                              !
  19. !  File contents                                                               !
  20. !                                                                              !
  21. ================================================================================
  22.  
  23. Files included are:
  24.  
  25. MBBIOS  .COM   -- The resident program.  Comes configured for COM1 and COM2 as
  26.                 standard ASYNC
  27.  
  28. MBBCONFG.COM   -- Configuration control program
  29. MS400   .MOD   -- How you share interrupts on a DFI MS-400 card
  30.  
  31. This ARC file may contain the source code.  If not, you can get it by
  32. sending an SASE with a standard IBM/PC 5 1/4" or 3 1/2" diskette to me
  33. at 8660 Del Rey Court, Gilroy, California, 95020.  Please format the
  34. disk so I know what density you want.
  35.  
  36. 8250con .asm   -- 8250 hardware constants
  37. 8250ini .asm   -- 8250 initialization
  38. 8250int .asm   -- 8250 interrupt handler
  39. 8250svc .asm   -- 8250 service call handler
  40. 8250svcx.asm   -- 8250 service call handler (extended)
  41. 8250tmr .asm   -- 8250 timer pop handler
  42.  
  43. qrqpcon .asm   -- Quadram QuadPort hardware constants
  44. qrqpini .asm   -- Quadram QuadPort initialization
  45.  
  46. 8530con .asm   -- 8530 hardware constants
  47. 8530ini .asm   -- 8530 initialization
  48. 8530int .asm   -- 8530 interrupt handler
  49. 8530svc .asm   -- 8530 service routines
  50. 8530tmr .asm   -- 8530 timer pop handler
  51. kiss    .asm   -- KISS constants
  52.  
  53. asmmb   .bat   -- BAT routine to assemble MBBIOS
  54.  
  55. mbbios  .asm   -- Main line
  56. mbbcom  .asm   -- Control block format
  57. mbbinit .asm   -- Initialization routine
  58. mbbinter.asm   -- Interrupt handler
  59. mbbload .asm   -- Load MBBIOS
  60. mbbsubr .asm   -- General Subroutines
  61. mbbtimer.asm   -- Timer pop handler
  62. mbbusvc .asm   -- User request service routine
  63.  
  64. mbcnf   .asm   -- ASM file configured for COM1 and two PC-100 ports
  65.  
  66. ================================================================================
  67. !                                                                              !
  68. !  Configuring                                                                 !
  69. !                                                                              !
  70. ================================================================================
  71.  
  72. Use MBBCONFG to configure the tables inside MBBIOS with regards to your
  73. particular hardware configuration.  All ports which share interrupts must be
  74. defined!  Thus if you a port on a PC-1XX, define both ports.  If you use a
  75. port on a MS-400 with the diode modification, you must define all the ports
  76. with diodes on them.
  77.  
  78. ================================================================================
  79. !                                                                              !
  80. !  Parameter explanations                                                      !
  81. !                                                                              !
  82. ================================================================================
  83.  
  84. The HIGH SPEED option is used to shift the data rate table.  See the
  85. explanation on AH=0 below.
  86.  
  87. TRANSMIT BUFFERING allows MBBIOS to return control to the calling
  88. program before the character is fully sent.
  89.  
  90. HARDWARE HANDSHAKING makes MBBIOS follow the RTS/CTS-DTR handshaking
  91. system used by many TNCs.
  92.  
  93. Recommended settings:
  94.  
  95.     Type BBS -->          RLI/MBL/BQE       Host mode (e.g. AA4RE BB)
  96.  
  97.     Transmit Buffering    Try ON.  If       Must be ON
  98.                           you get hangs,
  99.                           OFF
  100.  
  101.     Hardware Handshake    Must be ON        Must be OFF
  102.  
  103. ================================================================================
  104. !                                                                              !
  105. !  Using                                                                       !
  106. !                                                                              !
  107. ================================================================================
  108.  
  109. Simply execute MBBIOS before running the program that needs it.  If you
  110. wish to unload MBBIOS for some reason, issue MBBIOS /U.
  111.  
  112. ================================================================================
  113. !                                                                              !
  114. !  Software Notes                                                              !
  115. !                                                                              !
  116. ================================================================================
  117.  
  118. --------------------------------------------------------------------------------
  119. !                                                                              !
  120. !  ASYNC + Extended Support for BBS                                            !
  121. !                                                                              !
  122. --------------------------------------------------------------------------------
  123.  
  124. MBBIOS supports the standard INT 14 calls plus the extended ones as
  125. defined by Jeff Jacobsen, WA7MBL for his BBS program.  These are
  126. explained below.  AH=0 to AH=3 are identical to the IBM BIOS definition.
  127.  
  128. AH = 0     Initialize
  129. ---------------------
  130.  
  131. This initializes the communications port.  AL contains parity, stop bit,
  132. and word length as in the standard BIOS call.  On return, AH contains
  133. the Line Status Register information (except bit 0 - Data ready tells
  134. whether there is information in the extended buffer rather than the SIO
  135. chip receive buffer).  AL contains the Modem Status Register.
  136.  
  137. The baud rate is selected via AL.  If the high speed option is off, the
  138. rate is a specified for the standard BIOS call.  If the high speed
  139. option is on the speed settings are from the alternate table
  140.  
  141. High speed option off:
  142.  
  143.     MSB                                                     LSB
  144.      7       6       5       4       3       2       1       0
  145.      ----data-rate----       -Parity--    Stopbits   --Word length--
  146.  
  147.      000 -   110             X0 - none      0 - 1    10 - 7 bits
  148.      001 -   150             01 - odd       1 - 2    11 - 8 bits
  149.      010 -   300             11 - even
  150.      011 -   600
  151.      100 -  1200
  152.      101 -  2400
  153.      110 -  4800
  154.      111 -  9600
  155.  
  156. High speed option on:
  157.  
  158.     MSB                                                     LSB
  159.      7       6       5       4       3       2       1       0
  160.      ----data-rate----       -Parity--    Stopbits   --Word length--
  161.  
  162.      000 -    9600           X0 - none      0 - 1    10 - 7 bits
  163.      001 -   14400           01 - odd       1 - 2    11 - 8 bits
  164.      010 -   19200           11 - even
  165.      011 -   28800
  166.      100 -   38400
  167.      101 -   57600
  168.      110 -  115200
  169.      111 -  330400
  170.  
  171. The high speed option can be set either by MBBCONFG or by software
  172. using AH=9 (see below).
  173.  
  174.  
  175.  
  176. AH = 1     Send Character
  177. -------------------------
  178. AL contains the character to send.  Return values are the same as above.
  179.  
  180. AH = 2     Receive Character
  181. ----------------------------
  182.  
  183. On return, AL contains the character received.  AH contains the
  184. composite receive LSR.  This is done by ORing all LSRs on receive
  185. interrupts together.  Therefore the LSR returned does not necessarily
  186. match the LSR for the the character this routine returns).  Again, AH
  187. bit 0 indicates if there is additional characters in the buffer.  This
  188. routine does NOT timeout while waiting for a character but will hang
  189. indefinitely waiting for a character to appear.
  190.  
  191. AH = 3     Return Status
  192. ------------------------
  193.  
  194. Return values are the same as returned by the Initialize routine.
  195.  
  196. AH = 4     Inquiry
  197. ------------------
  198.  
  199. AH returns 0AAH.  AL returns 055H.  This call is used to see if the
  200. MBBIOS driver has been loaded for a particular port.
  201.  
  202. AH = 5     Drop RTS
  203. -------------------
  204.  
  205. This drops DTR (pin 20) and RTS (pin 4).  Used to tell the TNC not to
  206. send any more information.  TNC-1 and PK-232 use pin 4 for handshaking.
  207. TNC-2 uses pin 20 (dont ask me why!)  No return value.
  208.  
  209. AH = 6     Raise RTS
  210. --------------------
  211.  
  212. Raise DTR and RTS.  No return value.
  213.  
  214. AH = 7     Send Break
  215. ---------------------
  216.  
  217. Generates a "Break".  Useful for getting TNC-2 or PK-232 into Command
  218. mode from Converse or Transparent mode.  (However, if the TNC is sending
  219. characters at the time, they will be garbled.)  No return value.
  220.  
  221. AH = 8     Non-destructive Read
  222. -------------------------------
  223.  
  224. Returns the next character in the buffer in AL without removing it from
  225. the buffer.  AH value defined as in AH=2 so you can use the Data Ready
  226. bit to check to see if you really did get a character.
  227.  
  228. AH = 9     Set/Get options
  229. --------------------------
  230.  
  231. Set the current option byte to AL returning the old option byte in AL.
  232. The option byte is defined as follows:
  233.        .......xB    Transmit buffering (1 = on, 0 = off)
  234.        .....x..B    Hardware handshaking (1 = on, 0 = off)
  235.        ..x.....B    High speed option (1 = on, 0 = off)
  236.        xx.xx.x.B    Reserved.  May be in use on other types of devices
  237.  
  238. AH = A     Write buffer
  239. -----------------------
  240.  
  241. Sends CX characters starting at DI:ES.  Upon return, DI will be updated
  242. and CX will contain the unsent character count.  Unsent characters could
  243. result from either BUFFER FULL or hardware handshake is OFF.  AX will
  244. be set as in AH=3 (Status) above.
  245.  
  246. AH = B Read buffer
  247. ------------------
  248.  
  249. Receives up to CX characters starting at DI:ES.  Upon return, CX set to
  250. actual count read and DI is updated.  If the buffer is empty, return is
  251. immediate with CX = 0. On return, AL contains the MSR and AH has the
  252. composite receive LSR.  This is done by ORing all LSRs on receive
  253. interrupts together.  Therefore the LSR returned does not necessarily
  254. match the LSR for the the character this routine returns).  Again, AH
  255. bit 0 indicates if there is additional characters in the buffer.  This
  256. could happen if characters were received between the time of the buffer
  257. movement and the loading of the LSR into AH.
  258.  
  259. --------------------------------------------------------------------------------
  260. !                                                                              !
  261. !  PACCOM PC-100, PC-110, PC-120 support                                       !
  262. !                                                                              !
  263. --------------------------------------------------------------------------------
  264.  
  265. AH = 0     Initialize
  266. ---------------------
  267.  
  268. Parms
  269.   xxx..... = Data rate.  Use same settings as IBM ROM BIOS.
  270.              300 bps = 2, 1200 bps= 4.
  271.  
  272.   ...x.... = Full duplex if 1.  Half duplex if 0.
  273.  
  274.   ....x... = Error packet handler.  0 = throw away all error
  275.              packets.
  276.  
  277.   .....xxx = Don't care.  Use 0 for now!
  278.  
  279. Special case -- If AL = 0 then the COM port is closed!
  280.  
  281. The bits shown are used for parity on an ASYNC port and will be zero for
  282. a KISS interface so it should be compatible with TCP/IP usage of INT 14.
  283.  
  284. AH = 1,2   Send/Receive Characters
  285. ----------------------------------
  286.  
  287. See above.  Packets are handled in KISS format.  Note that all commands
  288. which set time are rounded to the nearest 50ms value.
  289.  
  290. AH = 3     Status
  291. -----------------
  292.  
  293. Returns AH.. AL=0
  294.      0.00000. = not assigned.  Zero
  295.      .x...... = If 0 then packets remain in the transmit queue
  296.      .......x = If 1 then data await in the receive queue
  297.  
  298. These bits correspond to THRE and RDA so are compatible to ASYNC ports
  299.  
  300. AH = 4     Inquiry
  301. ------------------
  302.  
  303. AH returns 0AAH.  AL returns 055H.  This call is used to see if the
  304. MBBIOS driver has been loaded for a particular port.
  305.  
  306. AH = 10    Send a packet
  307. ------------------------
  308.  
  309. ES = Segment of buffer containing the packet to be sent.  Note: The
  310. buffer pointed to by ES will be freed when the packet is sent unless
  311. this is turned off.  It should be gotten via Opcode 12. It must be 512
  312. bytes long and conform to the layout of the buffers
  313.  
  314.             Buffer Layout:
  315.  
  316.                 0 - 503 -- data (504 bytes long)
  317.               504 - 505 -- 16 bit data length
  318.               506       -- flags/status #1
  319.                               x........ = If 1 then don't discard
  320.                                           this buffer after xmt.
  321.                               .x....... = If 1 then this buffer has
  322.                                           been transmitted
  323.                               ..0000000 = not used
  324.               507       -- flags/status #2
  325.                               000000000 = not used
  326.               508 - 509 -- User field.  Not used by MBBIOS
  327.               510 - 511 -- MBBIOS uses as a pointer to next buffer in chain
  328.  
  329. AH = 11    Receive a packet
  330. ---------------------------
  331.  
  332. Returns ES with segment of buffer containing the packet received.  If
  333. zero, no such packet exists.
  334.  
  335. AH = 12    Buffer management
  336. ----------------------------
  337.  
  338. If ES is zero then returns a buffer segment in ES.  If ES is non-zero
  339. then the buffer pointed to is freed.
  340.  
  341. AH = 13    Set TXD -- Time from RTS to start or packet
  342. ------------------------------------------------------
  343.  
  344. AL = new setting in clock counts (54.3 ms)
  345.  
  346. AH = 14    Set P (persistance) -- Controls time from end of DCD to RTS
  347. ----------------------------------------------------------------------
  348.  
  349. AL = new setting.  255 = 1.0
  350.  
  351. AH = 15    Set Slot time -- Controls time from end of DCD to RTS
  352. ----------------------------------------------------------------
  353.  
  354. AL = new setting in clock counts (54.3 ms)
  355.  
  356. AH = 15    Set CRC wait -- time from start of last character to drop RTS
  357. ------------------------------------------------------------------------
  358.  
  359. AL = new setting in clock counts (54.3 ms)
  360.  
  361. Should be 5 character lengths minimum
  362.  
  363.